package com.cx.service.zd.Impl;

import com.cx.mapper.TrolleyMapper;
import com.cx.mapper.UserMapper;
import com.cx.pojo.ShoppingCar;
import com.cx.service.zd.TrolleyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TrolleyServiceImpl implements TrolleyService {

    @Autowired
    TrolleyMapper trolleyMapper;
    @Autowired
    UserMapper userMapper;
    @Override
    public List<ShoppingCar> selectAll(Integer userId) {
        List<ShoppingCar> shoppingCarList = trolleyMapper.selectAll(userId);
        return shoppingCarList;
    }

    @Override
    public int insert(ShoppingCar shoppingCar) {
        return 0;
    }

    @Override
    public int delete(Integer userId,Integer gameId) {
        int  affect = trolleyMapper.delete(userId,gameId);
        return affect;
    }


    @Override
    public int deleteAll(Integer userId) {
        int affect = trolleyMapper.deleteAll(userId);
        return affect;
    }

    @Override
    public int addCar(int userId, Integer gameId) {
        int affect = trolleyMapper.addCar(userId,gameId);
        return affect;
    }
}
